<template>
  <div>
    <Row class="search-info-style">
      <Col span="6">
        <span>姓&ensp;&ensp;&ensp;名&ensp;：</span>
        <Input v-model="params.name" placeholder="姓名" style="width:70%" />
      </Col>
      <Col span="6">
        <span>证件号码：</span>
        <Input v-model="params.card_no" placeholder="证件号码" style="width:70%" />
      </Col>
      <Col span="6">
        <span>所在区县：</span>
        <Input v-model="params.area" placeholder="所在区县" style="width:70%" />
      </Col>
      <Col style="float:right" pull="1">
        <Button class="new-btn-sty" @click="findtime()"><Icon type="ios-search" /> 搜索</Button>
      </Col>
    </Row>
    <Row class="search-info-style">
      <Col span="6">
        <span>所在街道：</span>
        <Input v-model="params.street" placeholder="所在街道" style="width:70%" />
      </Col>
      <Col span="6">
        <span>所在社区：</span>
        <Input v-model="params.community" placeholder="所在社区" style="width:70%" />
      </Col>
    </Row>
    <Table border :columns="columns1" :data="data1"></Table>
    <Row v-if="loadData == true">
      <Col class="demo-spin-col" span="8" offset="8">
        <Spin fix>
          <Icon type="ios-loading" size=18 class="demo-spin-icon-load"></Icon>
          <div>数据正在加载</div>
        </Spin>
      </Col>
    </Row>
    <Page :total="totalnum" :current="currentPageNo" :page-size="currentPageSize" @on-change="matterPage" class="page_style" show-sizer @on-page-size-change="SXsize"/>
    <Modal title="操作" v-model="operationshow" @on-ok="ok111" @on-cancel="operationshow=false">
      <Row class="item1">
        <Col span="7" style="text-align: right" class="">是否具备居家隔离条件:</Col>
        <Col span="10" offset="1">
          <Select v-model="paramData.is_agree" class="div-search" placeholder="请选择是否符合条件">
            <Option value="0">待确认</Option>
            <Option value="1">是</Option>
            <Option value="2">否</Option>
          </Select>
        </Col>
      </Row>
      <Row class="item1">
        <Col span="7" style="text-align: right" class="">备注:</Col>
        <Col span="10" offset="1">
          <Input v-model="paramData.remark" type="textarea" class="div-search" placeholder="如不具备，请说明原因。"></Input>
        </Col>
      </Row>
      <Row class="item1">
        <Col span="24" offset="1" style="color:red">
          注：如非本社区人员，请在备注中描述正确社区。
        </Col>
      </Row>
    </Modal>
    <Modal title="确认操作" v-model="confirmshow" @on-ok="ok222" @on-cancel="confirmshow=false">
      <p style="text-align: center;font-size: 2rem;color: red">注意:请您确认此操作,操作完成后将无法修改！！！</p>
      <p style="text-align: center;font-size: 2rem;color: red;margin-top:40px;">注意:本次为预推送，对方根据本次操作反馈结果，决定是否继续推送，等待对方实际推送后才会出现在列表中。</p>
    </Modal>
  </div>
</template>
<script>
import { findEstimateUserList, updateisagree } from '@/api/yi-qing-fang-kong'
export default {
  data () {
    return {
      loadData: true,
      operationshow: false,
      confirmshow: false,
      totalnum: 0,
      currentPageNo: 1,
      currentPageSize: 10,
      params: {},
      paramData: {},
      columns1: [
        { title: '序号', type: 'index', width: 70, align: 'center' },
        { title: '姓名', key: 'name', width: 100, align: 'center' },
        { title: '证件号码', key: 'card_no', width: 150, align: 'center' },
        { title: '性别', key: 'sex', width: 100, align: 'center' },
        { title: '手机号', key: 'mobile', width: 150, align: 'center' },
        { title: '所在区县', key: 'area', width: 100, align: 'center' },
        { title: '所在街道', key: 'street', width: 100, align: 'center' },
        { title: '所在社区', key: 'community', width: 100, align: 'center' },
        { title: '地址', key: 'address', width: 150, align: 'center' },
        { title: '到沈时间', key: 'arrive_time', width: 100, align: 'center' },
        { title: '交通方式', key: 'arrive_type', width: 100, align: 'center' },
        { title: '交通方式号码(车次/车牌号)', key: 'arrive_type_remark', width: 100, align: 'center' },
        { title: '来源地省', key: 'originate_province', width: 100, align: 'center' },
        { title: '来源地市', key: 'originate_city', width: 100, align: 'center' },
        { title: '推送时间', key: 'create_time', width: 100, align: 'center' },
        { title: '所属社区', key: 'company_code', width: 100, align: 'center' },
        { title: '来源', key: 'source', width: 100, align: 'center' },
        { title: '是否具备居家隔离条件', key: 'is_agree', width: 150, align: 'center' },
        { title: '反馈备注', key: 'remark', width: 100, align: 'center' },
        { title: '转运车牌号', key: 'transfer_id', width: 100, align: 'center' },
        { title: '转运人员姓名', key: 'transfer_name', width: 100, align: 'center' },
        { title: '转运人联系方式', key: 'transfer_tel', width: 100, align: 'center' },
        { title: '预计到达时间', key: 'estimate_supervise_time', width: 100, align: 'center' },
        {
          title: '操作',
          key: 'action',
          align: 'center',
          className: 'nopadding',
          minWidth: 150,
          render: (h, params) => {
            let temp = []
            temp.push(
              h('Button', {
                props: { type: 'primary', size: 'small' },
                style: { marginRight: '5px', backgroundColor: '#598ED1', borderColor: '#598ED1' },
                on: {
                  click: () => {
                    this.editNotice(params.row)
                  }
                }
              }, '操作')
            )
            return h('div', temp)
          }
        }
      ],
      data1: []
    }
  },
  methods: {
    init () {
      this.params.pageNo = this.currentPageNo
      this.params.pageSize = this.currentPageSize
      this.data1 = []
      this.loadData = true
      findEstimateUserList(this.params).then(res => {
        if (res.data.errcode === 0) {
          this.data1 = res.data.data.results
          this.totalnum = res.data.data.totalRecord
          this.loadData = false
        } else {
          this.loadData = false
          this.$Notice.error({ title: '获取列表失败', desc: res.errmsg })
        }
      })
    },
    editNotice (item) {
      this.operationshow = true
      this.paramData = item
    },
    ok111 () {
      this.confirmshow = true
    },
    ok222 () {
      updateisagree(this.paramData).then(res => {
        if (res.data.errcode === 0) {
          this.$Notice.success({
            title: '修改成功'
            // desc: '送检箱子创建成功' + res.data.data.success_num + '个样瓶'
          })
          this.init()
        } else {
          this.$Notice.error({ title: '修改失败', desc: '' })
          this.init()
        }
      })
    },
    matterPage (pageNo) {
      this.currentPageNo = pageNo
      this.init()
    },
    findtime () {
      this.currentPageNo = 1
      this.currentPageSize = 10
      this.init()
    },
    SXsize (pageSize) {
      this.currentPageSize = pageSize
      this.init()
    }
  },
  mounted () {
    this.init()
  }
}
</script>
<style>
  .page_style {
    margin-top: 10px;
    text-align: right;
  }
  .item1{
    height: 42px;
    line-height: 40px;
  }
  .search-info-style {
    margin: 10px;
  }
  .new-btn-sty {
    margin-right: 5px;
    color: #fff;
    background-color: #235CA7;
    border-color: #235CA7;
    font-weight: 500;
  }
</style>
